import { useAuth } from "context/auth-context";
import React, { FormEvent } from "react";
import { Form, Input, Button } from 'antd'
import { LongButton } from "unauthenticated-app";
const { Item } = Form
export const RegisterScreen = () => {
    const { register, user } = useAuth()
    const handleSubmit = (values: { username: string, password: string }) => {
        register(values)
    }
    return <Form onFinish={handleSubmit}>
        <Item name={'username'} rules={[{ required: true, message: '请输入用户名！' }]}>
            <Input type="text" id={"username"} placeholder="用户名" />
        </Item>
        <Item name={'password'} rules={[{ required: true, message: '请输入密码！' }]}>
            <Input type="password" id={"password"} placeholder="密码" />
        </Item>
        <Item>
            <LongButton type="primary" htmlType="submit">注册</LongButton>
        </Item>
    </Form>
}